import pymysql
import sys
import config

class DataService(object):
    def getList(self):
        conn = pymysql.connect(host=config.host,
            user=config.user,
            password=config.password,
            db=config.db)
        result = []
        try:
            cursor = conn.cursor(pymysql.cursors.DictCursor)
            cursor.execute("SELECT * from mock")
            result = cursor.fetchall()
        except Exceptioin, e:
            result = ""
        finally:
            cursor.close()
            conn.close()
        return result
